package cn.wolfcode.mq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;

/**
 * @Author: Ruomeng
 * @Date: 2025/1/27
 * @Description : shopseckill
 * @Version: 1.0
 */
@Slf4j
public class DefaultSendCallback implements SendCallback {

    private String tag;

    public DefaultSendCallback(String tag) {
        this.tag = tag;
    }

    @Override
    public void onSuccess(SendResult sendResult) {
        log.info("[异步消息回调{}] 发送消息成功：{}", tag, sendResult);
    }

    @Override
    public void onException(Throwable throwable) {
        log.error("[异步消息回调{}] 消息发送失败: {}", tag, throwable.getMessage());
    }
}
